<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Geolocation with GeoIP &mdash; Django 1.7.8.dev20150401230226 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.7.8.dev20150401230226',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="top" title="Django 1.7.8.dev20150401230226 documentation" href="../../../index.html" />
    <link rel="up" title="GeoDjango" href="index.html" />
    <link rel="next" title="GeoDjango Utilities" href="utils.html" />
    <link rel="prev" title="GDAL API" href="gdal.html" />



 
<script type="text/javascript" src="../../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../../index.html">Home</a>  |
        <a title="Table of contents" href="../../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../../genindex.html">Index</a>  |
        <a title="Module index" href="../../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="gdal.html" title="GDAL API">previous</a>
     |
    <a href="../../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="utils.html" title="GeoDjango Utilities">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-contrib-gis-geoip">
            
  <div class="section" id="s-module-django.contrib.gis.geoip">
<span id="s-geolocation-with-geoip"></span><span id="s-ref-geoip"></span><span id="module-django.contrib.gis.geoip"></span><span id="geolocation-with-geoip"></span><span id="ref-geoip"></span><h1>Geolocation with GeoIP<a class="headerlink" href="#module-django.contrib.gis.geoip" title="Permalink to this headline">¶</a></h1>
<p>The <a class="reference internal" href="#django.contrib.gis.geoip.GeoIP" title="django.contrib.gis.geoip.GeoIP"><tt class="xref py py-class docutils literal"><span class="pre">GeoIP</span></tt></a> object is a ctypes wrapper for the
<a class="reference external" href="http://www.maxmind.com/app/c">MaxMind GeoIP C API</a>. <a class="footnote-reference" href="#id6" id="id1">[1]</a></p>
<p>In order to perform IP-based geolocation, the <a class="reference internal" href="#django.contrib.gis.geoip.GeoIP" title="django.contrib.gis.geoip.GeoIP"><tt class="xref py py-class docutils literal"><span class="pre">GeoIP</span></tt></a> object requires
the GeoIP C library and either the GeoIP <a class="reference external" href="http://www.maxmind.com/app/country">Country</a> or <a class="reference external" href="http://www.maxmind.com/app/city">City</a>
datasets in binary format (the CSV files will not work!).  These datasets may be
<a class="reference external" href="http://www.maxmind.com/download/geoip/database/">downloaded from MaxMind</a>.  Grab the <tt class="docutils literal"><span class="pre">GeoLiteCountry/GeoIP.dat.gz</span></tt> and
<tt class="docutils literal"><span class="pre">GeoLiteCity.dat.gz</span></tt> files and unzip them in a directory corresponding to what
you set <a class="reference internal" href="#std:setting-GEOIP_PATH"><tt class="xref std std-setting docutils literal"><span class="pre">GEOIP_PATH</span></tt></a> with in your settings.  See the example and
reference below for more details.</p>
<div class="section" id="s-example">
<span id="example"></span><h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>Assuming you have the GeoIP C library installed, here is an example of its
usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">django.contrib.gis.geoip</span> <span class="kn">import</span> <span class="n">GeoIP</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">GeoIP</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">country</span><span class="p">(</span><span class="s">&#39;google.com&#39;</span><span class="p">)</span>
<span class="go">{&#39;country_code&#39;: &#39;US&#39;, &#39;country_name&#39;: &#39;United States&#39;}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">city</span><span class="p">(</span><span class="s">&#39;72.14.207.99&#39;</span><span class="p">)</span>
<span class="go">{&#39;area_code&#39;: 650,</span>
<span class="go">&#39;city&#39;: &#39;Mountain View&#39;,</span>
<span class="go">&#39;country_code&#39;: &#39;US&#39;,</span>
<span class="go">&#39;country_code3&#39;: &#39;USA&#39;,</span>
<span class="go">&#39;country_name&#39;: &#39;United States&#39;,</span>
<span class="go">&#39;dma_code&#39;: 807,</span>
<span class="go">&#39;latitude&#39;: 37.419200897216797,</span>
<span class="go">&#39;longitude&#39;: -122.05740356445312,</span>
<span class="go">&#39;postal_code&#39;: &#39;94043&#39;,</span>
<span class="go">&#39;region&#39;: &#39;CA&#39;}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">lat_lon</span><span class="p">(</span><span class="s">&#39;salon.com&#39;</span><span class="p">)</span>
<span class="go">(37.789798736572266, -122.39420318603516)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">lon_lat</span><span class="p">(</span><span class="s">&#39;uh.edu&#39;</span><span class="p">)</span>
<span class="go">(-95.415199279785156, 29.77549934387207)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">geos</span><span class="p">(</span><span class="s">&#39;24.124.1.80&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">wkt</span>
<span class="go">&#39;POINT (-95.2087020874023438 39.0392990112304688)&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-geoip-settings">
<span id="geoip-settings"></span><h2><tt class="docutils literal"><span class="pre">GeoIP</span></tt> Settings<a class="headerlink" href="#geoip-settings" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-geoip-path">
<span id="s-std:setting-GEOIP_PATH"></span><span id="geoip-path"></span><span id="std:setting-GEOIP_PATH"></span><h3>GEOIP_PATH<a class="headerlink" href="#geoip-path" title="Permalink to this headline">¶</a></h3>
<p>A string specifying the directory where the GeoIP data files are
located.  This setting is <em>required</em> unless manually specified
with <tt class="docutils literal"><span class="pre">path</span></tt> keyword when initializing the <a class="reference internal" href="#django.contrib.gis.geoip.GeoIP" title="django.contrib.gis.geoip.GeoIP"><tt class="xref py py-class docutils literal"><span class="pre">GeoIP</span></tt></a> object.</p>
</div>
<div class="section" id="s-geoip-library-path">
<span id="s-std:setting-GEOIP_LIBRARY_PATH"></span><span id="geoip-library-path"></span><span id="std:setting-GEOIP_LIBRARY_PATH"></span><h3>GEOIP_LIBRARY_PATH<a class="headerlink" href="#geoip-library-path" title="Permalink to this headline">¶</a></h3>
<p>A string specifying the location of the GeoIP C library.  Typically,
this setting is only used if the GeoIP C library is in a non-standard
location (e.g., <tt class="docutils literal"><span class="pre">/home/sue/lib/libGeoIP.so</span></tt>).</p>
</div>
<div class="section" id="s-geoip-country">
<span id="s-std:setting-GEOIP_COUNTRY"></span><span id="geoip-country"></span><span id="std:setting-GEOIP_COUNTRY"></span><h3>GEOIP_COUNTRY<a class="headerlink" href="#geoip-country" title="Permalink to this headline">¶</a></h3>
<p>The basename to use for the GeoIP country data file.
Defaults to <tt class="docutils literal"><span class="pre">'GeoIP.dat'</span></tt>.</p>
</div>
<div class="section" id="s-geoip-city">
<span id="s-std:setting-GEOIP_CITY"></span><span id="geoip-city"></span><span id="std:setting-GEOIP_CITY"></span><h3>GEOIP_CITY<a class="headerlink" href="#geoip-city" title="Permalink to this headline">¶</a></h3>
<p>The basename to use for the GeoIP city data file.
Defaults to <tt class="docutils literal"><span class="pre">'GeoLiteCity.dat'</span></tt>.</p>
</div>
</div>
<div class="section" id="s-geoip-api">
<span id="geoip-api"></span><h2><tt class="docutils literal"><span class="pre">GeoIP</span></tt> API<a class="headerlink" href="#geoip-api" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="django.contrib.gis.geoip.GeoIP">
<em class="property">class </em><tt class="descname">GeoIP</tt>(<span class="optional">[</span><em>path=None</em>, <em>cache=0</em>, <em>country=None</em>, <em>city=None</em><span class="optional">]</span>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>The <tt class="docutils literal"><span class="pre">GeoIP</span></tt> object does not require any parameters to use the default
settings.  However, at the very least the <a class="reference internal" href="#std:setting-GEOIP_PATH"><tt class="xref std std-setting docutils literal"><span class="pre">GEOIP_PATH</span></tt></a> setting
should be set with the path of the location of your GeoIP data sets.  The
following initialization keywords may be used to customize any of the
defaults.</p>
<table class="docutils">
<colgroup>
<col width="26%" />
<col width="74%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Keyword Arguments</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">path</span></tt></td>
<td>Base directory to where GeoIP data is located or the
full path to where the city or country data files
(.dat) are located.  Assumes that both the city and
country data sets are located in this directory;
overrides the <a class="reference internal" href="#std:setting-GEOIP_PATH"><tt class="xref std std-setting docutils literal"><span class="pre">GEOIP_PATH</span></tt></a> settings attribute.</td>
</tr>
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">cache</span></tt></td>
<td>The cache settings when opening up the GeoIP datasets,
and may be an integer in (0, 1, 2, 4) corresponding to
the <tt class="docutils literal"><span class="pre">GEOIP_STANDARD</span></tt>, <tt class="docutils literal"><span class="pre">GEOIP_MEMORY_CACHE</span></tt>,
<tt class="docutils literal"><span class="pre">GEOIP_CHECK_CACHE</span></tt>, and <tt class="docutils literal"><span class="pre">GEOIP_INDEX_CACHE</span></tt>
<tt class="docutils literal"><span class="pre">GeoIPOptions</span></tt> C API settings, respectively.
Defaults to 0 (<tt class="docutils literal"><span class="pre">GEOIP_STANDARD</span></tt>).</td>
</tr>
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">country</span></tt></td>
<td>The name of the GeoIP country data file.  Defaults
to <tt class="docutils literal"><span class="pre">GeoIP.dat</span></tt>.  Setting this keyword overrides the
<a class="reference internal" href="#std:setting-GEOIP_COUNTRY"><tt class="xref std std-setting docutils literal"><span class="pre">GEOIP_COUNTRY</span></tt></a> settings attribute.</td>
</tr>
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">city</span></tt></td>
<td>The name of the GeoIP city data file.  Defaults to
<tt class="docutils literal"><span class="pre">GeoLiteCity.dat</span></tt>.  Setting this keyword overrides
the <a class="reference internal" href="#std:setting-GEOIP_CITY"><tt class="xref std std-setting docutils literal"><span class="pre">GEOIP_CITY</span></tt></a> settings attribute.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="s-geoip-methods">
<span id="geoip-methods"></span><h2><tt class="docutils literal"><span class="pre">GeoIP</span></tt> Methods<a class="headerlink" href="#geoip-methods" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-querying">
<span id="querying"></span><h3>Querying<a class="headerlink" href="#querying" title="Permalink to this headline">¶</a></h3>
<p>All the following querying routines may take either a string IP address
or a fully qualified domain name (FQDN).  For example, both
<tt class="docutils literal"><span class="pre">'205.186.163.125'</span></tt> and <tt class="docutils literal"><span class="pre">'djangoproject.com'</span></tt> would be valid query
parameters.</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.city">
<tt class="descclassname">GeoIP.</tt><tt class="descname">city</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.city" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a dictionary of city information for the given query.  Some
of the values in the dictionary may be undefined (<tt class="docutils literal"><span class="pre">None</span></tt>).</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a dictionary with the country code and country for the given
query.</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_code">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_code</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_code" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns only the country code corresponding to the query.</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_name">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_name</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns only the country name corresponding to the query.</p>
</div>
<div class="section" id="s-coordinate-retrieval">
<span id="coordinate-retrieval"></span><h3>Coordinate Retrieval<a class="headerlink" href="#coordinate-retrieval" title="Permalink to this headline">¶</a></h3>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.coords">
<tt class="descclassname">GeoIP.</tt><tt class="descname">coords</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.coords" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a coordinate tuple of (longitude, latitude).</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.lon_lat">
<tt class="descclassname">GeoIP.</tt><tt class="descname">lon_lat</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.lon_lat" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a coordinate tuple of (longitude, latitude).</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.lat_lon">
<tt class="descclassname">GeoIP.</tt><tt class="descname">lat_lon</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.lat_lon" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a coordinate tuple of (latitude, longitude),</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.geos">
<tt class="descclassname">GeoIP.</tt><tt class="descname">geos</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.geos" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Returns a <a class="reference internal" href="geos.html#django.contrib.gis.geos.Point" title="django.contrib.gis.geos.Point"><tt class="xref py py-class docutils literal"><span class="pre">django.contrib.gis.geos.Point</span></tt></a> object corresponding to the query.</p>
</div>
<div class="section" id="s-database-information">
<span id="database-information"></span><h3>Database Information<a class="headerlink" href="#database-information" title="Permalink to this headline">¶</a></h3>
<dl class="attribute">
<dt id="django.contrib.gis.geoip.GeoIP.country_info">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_info</tt><a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_info" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>This property returns information about the GeoIP country database.</p>
<dl class="attribute">
<dt id="django.contrib.gis.geoip.GeoIP.city_info">
<tt class="descclassname">GeoIP.</tt><tt class="descname">city_info</tt><a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.city_info" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>This property returns information about the GeoIP city database.</p>
<dl class="attribute">
<dt id="django.contrib.gis.geoip.GeoIP.info">
<tt class="descclassname">GeoIP.</tt><tt class="descname">info</tt><a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.info" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>This property returns information about all GeoIP databases (both city
and country), and the version of the GeoIP C library (if supported).</p>
</div>
<div class="section" id="s-geoip-python-api-compatibility-methods">
<span id="geoip-python-api-compatibility-methods"></span><h3>GeoIP-Python API compatibility methods<a class="headerlink" href="#geoip-python-api-compatibility-methods" title="Permalink to this headline">¶</a></h3>
<p>These methods exist to ease compatibility with any code using MaxMind&#8217;s
existing Python API.</p>
<dl class="classmethod">
<dt id="django.contrib.gis.geoip.GeoIP.open">
<em class="property">classmethod </em><tt class="descclassname">GeoIP.</tt><tt class="descname">open</tt>(<em>path</em>, <em>cache</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.open" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>This classmethod instantiates the GeoIP object from the given database path
and given cache setting.</p>
<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.region_by_addr">
<tt class="descclassname">GeoIP.</tt><tt class="descname">region_by_addr</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.region_by_addr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.region_by_name">
<tt class="descclassname">GeoIP.</tt><tt class="descname">region_by_name</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.region_by_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.record_by_addr">
<tt class="descclassname">GeoIP.</tt><tt class="descname">record_by_addr</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.record_by_addr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.record_by_name">
<tt class="descclassname">GeoIP.</tt><tt class="descname">record_by_name</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.record_by_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_code_by_addr">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_code_by_addr</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_code_by_addr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_code_by_name">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_code_by_name</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_code_by_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_name_by_addr">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_name_by_addr</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_name_by_addr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="django.contrib.gis.geoip.GeoIP.country_name_by_name">
<tt class="descclassname">GeoIP.</tt><tt class="descname">country_name_by_name</tt>(<em>query</em>)<a class="headerlink" href="#django.contrib.gis.geoip.GeoIP.country_name_by_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p class="rubric">Footnotes</p>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.</td></tr>
</tbody>
</table>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Geolocation with GeoIP</a><ul>
<li><a class="reference internal" href="#example">Example</a></li>
<li><a class="reference internal" href="#geoip-settings"><tt class="docutils literal"><span class="pre">GeoIP</span></tt> Settings</a><ul>
<li><a class="reference internal" href="#geoip-path">GEOIP_PATH</a></li>
<li><a class="reference internal" href="#geoip-library-path">GEOIP_LIBRARY_PATH</a></li>
<li><a class="reference internal" href="#geoip-country">GEOIP_COUNTRY</a></li>
<li><a class="reference internal" href="#geoip-city">GEOIP_CITY</a></li>
</ul>
</li>
<li><a class="reference internal" href="#geoip-api"><tt class="docutils literal"><span class="pre">GeoIP</span></tt> API</a></li>
<li><a class="reference internal" href="#geoip-methods"><tt class="docutils literal"><span class="pre">GeoIP</span></tt> Methods</a><ul>
<li><a class="reference internal" href="#querying">Querying</a></li>
<li><a class="reference internal" href="#coordinate-retrieval">Coordinate Retrieval</a></li>
<li><a class="reference internal" href="#database-information">Database Information</a></li>
<li><a class="reference internal" href="#geoip-python-api-compatibility-methods">GeoIP-Python API compatibility methods</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="gdal.html">GDAL API</a></li>
    
    
      <li>Next: <a href="utils.html">GeoDjango Utilities</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a>
        
          <ul><li><a href="../../index.html">API Reference</a>
        
          <ul><li><a href="../index.html"><tt class="docutils literal"><span class="pre">contrib</span></tt> packages</a>
        
          <ul><li><a href="index.html">GeoDjango</a>
        
        <ul><li>Geolocation with GeoIP</li></ul>
        </li></ul></li></ul></li></ul>
      </li>
  </ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/ref/contrib/gis/geoip.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Apr 02, 2015</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="gdal.html" title="GDAL API">previous</a>
     |
    <a href="../../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="utils.html" title="GeoDjango Utilities">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>